<template>
	<view >
		<view class="top" :style="`padding-top:`+$store.state.StatusBar.statusBar + `px`">
			<view class="top-icon"   @click="back">
				<u-icon name="arrow-left" size="42rpx" color='#fff'></u-icon>
			</view>
			<view class="top-title c-fff" >{{title}}</view>
		</view>
		<view class="body" :style="`margin-top:`+$store.state.StatusBar.statusBar + `px`">
			<view style="width:100%; height:100rpx; padding-left:20rpx; padding-rgith:20rpx; margin-bottom:20rpx;">
				<view style="color:#fff; font-size:20rpx; ">当前城市</view>
				<view>
					<view @tap="isPay" style="color:#fff; margin-top:20rpx; font-size:26rpx;">
						<image src="./img/adress_icon.png" mode="aspectFill" style="width:30rpx; height:30rpx;"></image>
						{{address}}
					</view>
					<image @click="refresh" src="./img/audio_refresh_icon.png" mode="aspectFill" style="width:30rpx; height:30rpx; position:absolute; right:10rpx; transform: translateY(-30rpx);"></image>
				</view>
			</view>
			<view class="left">
				<view class="item" :class="rightInfo.id == item.id ? 'on' : ''" @tap="changeLeft(item)" v-for="(item,index) in info.list">
					{{item.province}}
				</view>
			</view>
			<view class="right">
				<view class="item" v-for="(item,index) in rightInfo.citiesList">
					{{item.city}}
				</view>
			</view>
		</view>
	</view>
</template>


<script>
	import {to} from '@/utils/index.js';
	export default {
		data() {
			return {
				title: '选择城市',
				address: "未知",
				info: {},
				rightInfo:[]
			}
		},
		onLoad(option) {
			
		},
		onShow(option){
			this.getInfo();
		},
		methods: {
			to,
			back(){
				to()
			},
			changeLeft(row){
				this.rightInfo = row
			},
			async isPay() {
				let res = await this.$c.post("/app/tickUserInfo/info");
				if (res.code == 0) {
					if (res.data.windowTicket == 1) {
						// this.refresh()
					}
					res = await this.$c.post("/app/tickPrice/info");
					this.pay = res.data;
					uni.hideTabBar()
					this.$refs.pay.open("bottom");
				}
			},
			//刷新定位
			// refresh(){
			// 	uni.showLoading({
			// 		title:"定位中"
			// 	})
			// 	uni.getLocation({
			// 		type: 'wgs84',
			// 		success: function(res) {
			// 			console.log(res);
			// 			console.log('当前位置的经度：' + res.longitude);
			// 			console.log('当前位置的纬度：' + res.latitude);
			// 			this.address = res.address.city
			// 			this.longitude = res.longitude
			// 			this.latitude = res.latitude
			// 			uni.hideLoading()
			// 		}
			// 	});
			// },
			async getInfo(){
				let res = await this.$c.post("/app/geren/sslist")
				if(res.code == 1002){
					uni.navigateTo({
					  url: '/im/login/login'
					});
				}
				this.info = res.data
				this.rightInfo = this.info.list[0]
				this.refresh();
				console.log(this.rightInfo)
			}
		}
	}
</script>

<style scoped lang="scss">
	.page {
		width: 90vw;
		padding:40rpx;
		height: 100vh;
		background: linear-gradient(#e3ecfb, #fdedf0, #fff, #fff);
	}
	.charm{
		text-align:center;
		float:right;
		width: 35vw; height:300rpx;
		background: rgba(255, 255, 255, 0.1);
		// background-image: url("./img/ic_wallet_charm_bg.png");
		background-size: 100%;
		background-position: center center;
		border-radius: 40rpx;
		padding:30rpx;
	}
	.top {
		position: fixed;
		top: 0rpx;
		width: 100%;
		z-index: 999;
		text-align: center;
		vertical-align: middle;
		padding:10rpx;
		background-color: none;
	}
	.top-icon {
		position: absolute;
		left: 30rpx;
		z-index: 99;
		width: 30rpx;
		height: 30rpx;
	}
	.top-title {
		line-height: 50rpx;
		display: block;
		height:50rpx;
		z-index: 99;
	}

	.body{
		padding-top:60rpx;
	}
	.nav {
		box-sizing: border-box;
		padding: 0 30rpx;
		width: 100%;
		height: 100rpx;

		.nav-icon {
			width: 40rpx;
			height: 40rpx;
		}

		.nav-list {
			height: 100%;

			.nav-list-item {
				width: 150rpx;
				height: 100%;

				.nav-list-item-title {
					margin-bottom: 10rpx;
					transition: all .3s;
				}

				.nav-str {
					opacity: 0;
					width: 50rpx;
					height: 14rpx;
					border-radius: 7rpx;
					transition: all .3s;
				}
			}

			.nav_list_item {
				font-size: 34rpx;

				.nav-list-item-title {
					transition: all .3s;
					color: #e6166a;
				}

				.nav-str {
					opacity: 1;
					background-color: #e6166a;
				}
			}

		}
	}

	.page-current {
		position: relative;
		width: 100%;
		height: 0;

		.scroll-v {
			position: relative;
			box-sizing: border-box;
			width: 100%;
			height: 0;
		}
	}

	.button{
		// background-color: #000;
		background: linear-gradient(180deg, #FDB175 5%, #F49C66 100%);
		color:#feffab;
		display: inline-block;
		padding:15rpx 30rpx;
		border-radius: 30rpx;
		font-size:24rpx;
	}

	.detail{
		padding:20rpx;
	}
	.left {
		display:inline-block;
		width:300rpx;
		// position: absolute;
		// left:0rpx;
		.item{
			widht:300rpx;
			background-color: #000;
		}
		.on{
			background-color: #999 !important;
		}
		z-index:100;
		overflow-y: scroll;
	}
	.right {
		display:inline-block;
		width:450rpx;
		float:right;
		// position: absolute;
		// right:0rpx;
		.item{
			background-color: #999;
			border-bottom: #e3ecfb;
		}
	}
	.item {
		text-align: center;
		width: 100% ;
		height: 60rpx;
		color:#fff;
		padding:10rpx;
	}
</style>